package com.swust.exam.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController; 
import com.swust.exam.pojo.Exam;
import com.swust.exam.service.ExamService;

@RestController
public class ExamController {
	
	@Autowired
	private ExamService examService;
	
	@GetMapping(value = "/exam/get")
	public Exam examGet(int id)
	{
		return examService.get(id);
	}
	
	
	@DeleteMapping(value="/exam/delete")
	public int examDelete(int id) {
		return examService.delete(id);
	}
	
	@PostMapping(value="/exam/insert")
	public int examInsert(Exam exam) {
		return examService.insert(exam);
	}
	
	@PutMapping(value="/exam/update")
	public int examUpdate(Exam exam) {
		return examService.update(exam);
	}
		
	
}
